package com.bbx.taxi.client.Adapter;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.bbx.taxi.client.R;
import com.bbx.taxi.client.Activity.Menu.SetActivity;
import com.bbx.taxi.client.DB.Util.DBcolumns;
import com.bbx.taxi.client.Util.FormatUtil;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
/** 
 * @Path com.bbx.taxi.client.Adapter.FareDetailsAdapter.java
 * @Author 严旭文
 * @Date 2016-2-29 下午3:51:43
 * @Company 蓝海（福建）信息技术有限公司
 * @Description
 * 车费估计
 */
public class FareDetailsAdapter extends BaseAdapter {
	public static final String PAYDETAIL_NAME = "paydetail_name";
	public static final String PAYDETAIL_MONEY = "paydetail_money";
	private List<Map<String, String>> list;
	private Context main;
	/**
	 * 支付的费用明细列表
	 *
	 */
	public FareDetailsAdapter(Context context,List<Map<String, String>> list) {
		this.list=list;
	   main=context;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
		
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		ViewHolder viewholder;
		if(convertView==null){      
		LayoutInflater inflater=LayoutInflater.from(main);
		convertView=(View)inflater.inflate(R.layout.item_paydetail,null);        
		viewholder=new ViewHolder();
		viewholder.tv_name=(TextView)convertView.findViewById(R.id.tv_name);	
		viewholder.tv_money=(TextView)convertView.findViewById(R.id.tv_money);	
		viewholder.layout_money=(RelativeLayout)convertView.findViewById(R.id.layout_money);	
		convertView.setTag(viewholder);	
		}
		else viewholder=(ViewHolder)convertView.getTag();
		viewholder.tv_name.setText(list.get(position).get(PAYDETAIL_NAME));
		viewholder.tv_money.setText(list.get(position).get(PAYDETAIL_MONEY));
		return convertView;
		
}
	public class ViewHolder{                   
		TextView tv_name,tv_money;
		RelativeLayout layout_money;
	}
}
